<?php
/** 
 * @Version: 1.0
 * @Author: Fabricio S Costa
 * Date: 16/10/2009
 * email: fabriciojf@gmail.com
 */
class Dao {
    public static function save($objeto, $classe) {
        require_once('com/fabriciojf/persistence/' . $classe . 'DAO.class.php');
        $className = $classe . 'Dao';
        $temp = new $className;
        return $temp->save($objeto);
    }

    public static function update($objeto, $classe) {
        require_once('com/fabriciojf/persistence/' . $classe . 'DAO.class.php');
        $className = $classe . 'Dao';
        $temp = new $className;
        return $temp->update($objeto);
    }

    public static function remove($id, $classe) {
        require_once('com/fabriciojf/persistence/' . $classe . 'DAO.class.php');
        $className = $classe . 'Dao';
        $temp = new $className;
        return $temp->remove($id);
    }

    public static function listAll($classe) {
        require_once('com/fabriciojf/persistence/' . $classe . 'DAO.class.php');
        $className = $classe . 'Dao';
        $temp = new $className;
        return $temp->listAll();
    }

    public static function findForId($id, $classe) {
        require_once('com/fabriciojf/persistence/' . $classe . 'DAO.class.php');
        $className = $classe . 'Dao';
        $temp = new $className;
        return $temp->findForId($id);
    }

    public static function findForCnpj($cnpj, $classe) {
        require_once('com/fabriciojf/persistence/' . $classe . 'DAO.class.php');
        $className = $classe . 'Dao';
        $temp = new $className;
        return $temp->findForCnpj($cnpj);
    }

    public static function findForName($nome, $classe) {
        require_once('com/fabriciojf/persistence/' . $classe . 'DAO.class.php');
        $className = $classe . 'Dao';
        $temp = new $className;
        return $temp->findForName($nome);
    }
}
?>
